package com.surface.hao.util;

import com.surface.hao.component.ScrollPanel;

import javax.swing.*;
import java.awt.*;

/**
 * @Description: 组件工具类
 * @Author: songhao
 * @Email:425008064@qq.com
 * @CreateDate: 2019/12/30 14:05
 */
public class ComponentUtils {

    /**
     * 给输入框设置内容信息
     * @param textArea
     * @param message
     */
    public static void setTips(ScrollPanel textArea, String message){
        textArea.setText(textArea.getText() + DateUtils.getFormatDate() + " " + message + "\n");
    }

    /**
     * 获取一个下拉框组件
     */
    public static JComboBox getJcomboBox(){
        JComboBox cmb = new JComboBox();    //创建JComboBox
        cmb.setPreferredSize(new Dimension(100,40));
        cmb.addItem("秒(s)");
        cmb.addItem("毫秒(ms)");
        return cmb;
    }
}
